package com.stroke.tools.animation;

import com.stroke.util.IOHelper;

import java.awt.*;
import java.io.File;

/**
 * Author: Igor Bubelov
 * Date: 3/13/11 12:00 PM
 */
public class Frame {
    private String name;
    private String format;
    private Integer position;
    private Image image;

    public Frame(File file, Integer position) {
        this.name = file.getName();
        this.format = IOHelper.getFormatName(file);
        this.position = position;
        this.image = IOHelper.loadImage(file);
    }

    public String getName() {
        return name;
    }

    public String getFormat() {
        return format;
    }

    public Integer getPosition() {
        return position;
    }

    public void incPosition() {
        position++;
    }

    public void decPosition() {
        position--;
    }

    public Image getImage() {
        return image;
    }

    @Override
    public String toString() {
        return position.toString();
    }
}